package com.tuzhi.sys.jpa.repository;

import com.tuzhi.base.jpa.repository.BaseRepo;
import com.tuzhi.sys.jpa.entity.UserRoleMenuViewEntity;
import com.tuzhi.sys.jpa.entity.pk.UserRoleMenuPk;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface UserRoleMenuRepo extends BaseRepo<UserRoleMenuViewEntity, UserRoleMenuPk> {
    @Query("select perms from UserRoleMenuViewEntity where userId=:userId and roleStatus=0 and menuStatus=0")
    List<String> loadPerms4User(@Param("userId") Long userId);

    @Query("select url from UserRoleMenuViewEntity where userId=:userId and roleStatus=0 and menuStatus=0")
    List<String> loadUrls4User(@Param("userId") Long userId);

    @Query("select menuId from UserRoleMenuViewEntity where userId=:userId and roleStatus=0 and menuStatus=0")
    List<Long> findMenuIds(@Param("userId") Long userId);
}
